﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using CommonUtility.IO;

namespace SmartUIBll
{
    public class UploadHandle : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string result = "0";
            if (context.Request.Files.Count > 0)
            {
                HttpPostedFile file = context.Request.Files[0];
                if (file.ContentLength <= 200 * 1024)//小于200k
                {
                    string strName = context.Request.Form["hidUPFName"];
                    if (!string.IsNullOrEmpty(strName) && FileTools.UploadFile(context.Request.Files[0], strName))
                        result = "1";
                }
                else
                    result = "2";
            }
            context.Response.Write(result);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
